package cn.ac.ict.fpevaluation.utils;

import cn.ac.ict.fpevaluation.bean.AtomTrajectoryBean;
import cn.ac.ict.fpevaluation.bean.StepBean;
import cn.ac.ict.fpevaluation.fastdtw.test.MagneticSample;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wuyouxiong on 2017/3/3.
 */
public class MagneticHelper {

    public static ArrayList<MagneticSample> getMagneticListFromTraj(AtomTrajectoryBean trajectory) {
        ArrayList<MagneticSample> samples = new ArrayList<MagneticSample>();

        for (StepBean step : trajectory.getStepList()) {
            int size = step.getxMagnetic().size();
            for (int j = 0; j < size; j++) {
                MagneticSample sample = new MagneticSample();
                sample.setMagXOrigin(step.getxMagnetic().get(j));
                sample.setMagYOrigin(step.getyMagnetic().get(j));
                sample.setMagZOrigin(step.getzMagnetic().get(j));
                samples.add(sample);
            }
        }

        return samples;
    }
}
